package com.lry.basic.design_mode.strategy;

/**
 * @author:刘仁有
 * @desc:
 * @email:953506233@qq.com
 * @data:2019/11/11
 */
public class Context {
    private Operation operation;
    public void setOperation(Operation operation){
        this.operation = operation;
    }

    public double execute(double op1,double op2){
        if(operation==null){
            throw new RuntimeException("请设置运算策略");
        }
        return operation.operation(op1,op2);
    }
}
